<?php
defined('_JEXEC') or die('Restricted access');
$item = $this->detail;
$template = "templates/tpl_automobil/";
$user = JFactory::getUser();
$db = JFactory::getDBO();
$q = "SELECT image, image1, image2, image3, image4 FROM #__pr_product WHERE id = ".$item->id;
$db->setQuery($q);
$imageList = $db->loadRow();
$imgNum = 0;
foreach($imageList as $image){
	if($image) $imgNum++;
}

?>
<link rel="stylesheet" type="text/css" href="<?php echo $template;?>fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript" src="<?php echo $template;?>fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="<?php echo $template;?>fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script language="javascript">
	jQuery(document).ready(function(){
		jQuery("#mycarouse").jCarouselLite({
			btnNext: ".next1",
			btnPrev: ".prev1",
			visible : 4,
			scroll: 1,
			speed : 400
		});
		
		jQuery("a[rel=example_group]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Billede ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});
		postFacebookWallDetail = function(urlencode){
			t=document.title; 
			window.open('http://www.facebook.com/sharer.php?u='+urlencode,'sharer','toolbar=0,status=0,width=626,height=436'); 
			return false; 
		}
	});	
</script>
<style>
.init_img{
	display:inline-block;
	height:61px;
	width:98px;
}
#fancybox-title{display:none !important}
</style>
<p>
	<span class="float_left f28"><?php echo $item->id;?> - <?php echo $item->model;?></span>
    <span class="link-login"><span class="link-login"><a href="index.php?option=com_user&view=user&layout=profile&Itemid=13"><?php if($user->guest==0) {echo  "Min Profil";} ;?></a><a href="index.php?option=com_user&view=login&task=logout&Itemid=13" class="m12l"><?php if($user->guest==0) {echo  "Log ud";};?></a></span>
</p>
<div class="cb"></div>
<div class="tt m10b"></div>

<div class="p5t">
	<div class=" p15t">
    	<div class="w462 float_left">
        	<div class="box_katalog">
            	<?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$item->image."&w=447&h=296&zc=1' title='".$item->model."' alt='".$item->model ."' />";?>
            </div>
            <div class="w451">
            	<?php if($imgNum > 4){?>
              	<div class="nav_prev"><a class="prev1" href="javascript:;"><img src="<?php echo $template;?>images/icon_prev1.png.jpg"></a></div>
                <?php }?>
              	<div id="mycarouse" class="thunb_katalog float_left" style="overflow: hidden;">
                    <ul class="list_img">
                    	<?php if($item->image){?>
                        <li>
                        <a rel="example_group" href="<?php echo JURI::root(false).'components/com_ecommerce/imgupload/'.$item->image;?>" title="" class="init_img">
                        <?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$item->image."&w=98&h=61&zc=1' title='".$item->model."' alt='".$item->model ."' />";?>
                        </a>
                        </li>
                        <?php }?>
                        <?php if($item->image1){?>
                        <li>
                        <a rel="example_group" href="<?php echo JURI::root(false)."components/com_ecommerce/imgupload/".$item->image1;?>" class="init_img" >
                        <?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$item->image1."&w=98&h=61&zc=1' title='".$item->model."' alt='".$item->model ."' />";?>
                        </a>
                        </li>
                        <?php }?>
                        <?php if($item->image2){?>
                        <li>
                        <a rel="example_group" href="<?php echo JURI::root(false)."components/com_ecommerce/imgupload/".$item->image2;?>" class="init_img">
                        <?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$item->image2."&w=98&h=61&zc=1' title='".$item->model."' alt='".$item->model ."' />";?>
                        </a>
                        </li>
                        <?php }?>
                        <?php if($item->image3){?>
                        <li>
                        <a rel="example_group" href="<?php echo JURI::root(false)."components/com_ecommerce/imgupload/".$item->image3;?>" class="init_img">
                        <?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$item->image3."&w=98&h=61&zc=1' title='".$item->model."' alt='".$item->model ."' />";?>
                        </a>
                        </li>
                        <?php }?>
                        <?php if($item->image4){?>
                        <li>
                        <a rel="example_group" href="<?php echo JURI::root(false)."components/com_ecommerce/imgupload/".$item->image4;?>" class="init_img">
                        <?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$item->image4."&w=98&h=61&zc=1' title='".$item->model."' alt='".$item->model ."' />";?>
                        </a>
                        </li>
                        <?php }?>
                    </ul>
                	<div class="cb"></div>
              	</div>
                <?php if($imgNum > 4){?>
              	<div class="nav_next"><a class="next1" href="javascript:;"><img src="<?php echo $template;?>images/icon_next1.png.jpg" /></a></div>
                <?php }?>
              	<div class="cb"></div>
            </div>
            <!--<div class="coming">Livestream vil være følgende:</div>
            <div id="countDownArea" class="countdown">
            </div>-->
            
             <div class="box_katalog">
				 <object width="450" height="336" border="0" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
                    <param value="clientView.swf" name="movie" />
                    <param value="transparent" name="wmode" />
                    <embed width="450" height="336" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/get/flashplayer" src="clientView.swf" />
                </object>
			</div>
            <div class="p15t w451">
                <div class="box_text_katalog_detail">
                    <div class="title_text_katalog">Information</div>
                    <div class="p10">
                    	<?php echo $item->comment;?>
                    </div>
                </div>
                <div class="cb"></div>
			</div>
		</div>
        <div class="w276 float_right">
            <div class="box_derip_katalog1 box_text_katalog_detail">
            <div class="title_text_katalog"><a href="tilmeld-bil.html">Tilmeld din bil</a></div>
              <div class="p10">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                  	<td colspan="2" align="left"><a onclick="postFacebookWallDetail('<?php echo "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];?>')" href="javascript:void(0);"><img src="images/sharefb.jpg" alt=""/></a></td>
                  </tr>
                  <tr>
                    <td width="35%"><strong>Tilmelding af bilen Biltype: </strong></td>
                    <td width="65%"><?php echo $item->car_type;?></td>
                  </tr>
                  <tr>
                    <td><strong>Mærke/Model:</strong></td>
                    <td><?php echo $item->model;?></td>
                  </tr>
                  <tr>
                    <td><strong>Brændstof:</strong></td>
                    <td><?php echo $item->fuel;?></td>
                  </tr>
                  <tr>
                    <td><strong>1st Reg.: </strong></td>
                    <td><?php echo $item->register_day;?></td>
                  </tr>
                  <tr>
                    <td><strong>Seneste syn:</strong> </td>
                    <td><?php echo $item->view_day;?></td>
                  </tr>
                  <tr>
                    <td><strong>Skal synes: </strong></td>
                    <td><?php if($item->registry) echo "Ja"; else echo "Nej";?></td>
                  </tr>
                  <tr>
                    <td><strong>Stand/Kategori:</strong></td>
                    <td><?php echo $item->stand;?></td>
                  </tr>
                  <tr>
                    <td><strong>Km.stand: </strong></td>
                    <td><?php echo $item->km;?></td>
                  </tr>
                   <tr>
                    <td><strong>Registeringsnummer: </strong></td>
                    <td><?php echo $item->carid;?></td>
                  </tr>
                  <?php if($item->color){?>
                   <tr>
                    <td><strong>Farve: </strong></td>
                    <td><?php echo $item->color;?></td>
                  </tr>
                  <?php }?>
                   <?php if($item->color_type){?>
                   <tr>
                    <td><strong>Lakstand: </strong></td>
                    <td><?php echo $item->color_type;?></td>
                  </tr>
                  <?php }?>
                   <?php if($item->cabin_color){?>
                   <tr>
                    <td><strong>Kabinefarve: </strong></td>
                    <td><?php echo $item->cabin_color;?></td>
                  </tr>
                  <?php }?>
                   <?php if($item->chassis){?>
                   <tr>
                    <td><strong>Stelnummer: </strong></td>

                    <td><?php echo $item->chassis;?></td>
                  </tr>
                  <?php }?>
                </table>
              </div>
            </div>
        </div>
        <p class="cb"></p>
        <?php if($item->placering == "Dansk Automobil Børs") echo $this->loadTemplate('info'); else echo $this->loadTemplate('info1');?>
    </div>
</div>